Diagrama TS

Vamos elaborar um diagrama TS com o auxílio do pacote gsw [https://pypi.python.org/pypi/gsw/3.0.3], que é uma alternativa em python para a toolbox gsw do MATLAB:


In [2]:
import gsw

Em seguida, importamos a biblioteca numpy que nos permite usar algumas funções matemáticas no python:


In [3]:
import numpy as np

In [4]:
s = np.linspace(0, 42, 100)
t = np.linspace(-2, 40, 100)

s, t = np.meshgrid(s, t)

sigma = gsw.sigma0(s, t)

In [5]:
%matplotlib notebook
import matplotlib.pyplot as plt

cnt = np.arange(-7, 35, 5)

fig, ax = plt.subplots(figsize=(5, 5))
cs = ax.contour(s, t, sigma, colors='blue', levels=cnt)
ax.clabel(cs, fontsize=9, inline=1, fmt='%2i')

ax.set_xlabel('Salinity [g kg$^{-1}$]')
ax.set_ylabel('Temperature [$^{\circ}$C]')


Out[5]:
<matplotlib.text.Text at 0x7f4eb59b37f0>

In [ ]: